<script>
import Manage from "@/views/Manage.vue";
import Login from "@/views/Login.vue";
export default {
  name: "Aside",
  props: {
    isCollapse: Boolean
  },
  data() {
    return {
      Authorities: localStorage.getItem("authorities") ? JSON.parse(localStorage.getItem("authorities")) : {},
    }
  },
  created() {
    console.log(this.Authorities);
  },
  methods: {
    handleSelect(index) {
      console.log(index)
      console.log(this.$router.options.routes)
    }
  }
}
</script>

<template>
  <el-menu :default-openeds="['2', '3']" style="min-height:100%; overflow-x: hidden"
           background-color="rgb(48,65,86)"
           text-color="#fff"
           active-text-color="#ffd04b"
           :collapse-transition="false"
           :collapse="isCollapse"
           router
           @select="handleSelect"
  >
    <div style="height:60px;line-height:60px;text-align:center">
      <img src="../assets/logo.png" alt="" style="width:20px;position:relative; top:5px">
      <b style="color:white;font-size:20px; margin-left:5px" v-show="!isCollapse">用户权限系统</b>
    </div>
    <el-menu-item index="/home">
      <template>
        <i class="el-icon-house"></i>
        <span slot="title">主页</span>
      </template>
    </el-menu-item>
    <el-submenu index="2" v-show="this.Authorities.Authority1">
      <template slot="title">
        <i class="el-icon-menu"></i>
        <span slot="title" >用户管理</span>
      </template>
      <el-menu-item index="/user" v-show="this.Authorities.Authority2">
        <i class="el-icon-s-custom"></i>
        <span slot="title">用户信息管理</span>
      </el-menu-item>
      <el-menu-item index="/userRole" v-show="this.Authorities.Authority7">
        <i class="el-icon-service"></i>
        <span slot="title">用户角色管理</span>
      </el-menu-item>
      <el-menu-item index="/userAuthority" v-show="this.Authorities.Authority12">
        <i class="el-icon-edit"></i>
        <span slot="title">用户权限查看</span>
      </el-menu-item>
    </el-submenu>
    <el-submenu index="3" v-show="this.Authorities.Authority13">
      <template slot="title">
        <i class="el-icon-setting"></i>
        <span slot="title">系统管理</span>
      </template>
      <el-menu-item index="/role" v-show="this.Authorities.Authority14">
        <i class="el-icon-service"></i>
        <span slot="title">角色管理</span>
      </el-menu-item>
      <el-menu-item index="/authority" v-show="this.Authorities.Authority17">
        <i class="el-icon-edit"></i>
        <span slot="title">权限管理</span>
      </el-menu-item>
      <el-menu-item index="/roleAuthority" v-show="this.Authorities.Authority20">
        <i class="el-icon-postcard"></i>
        <span slot="title">角色权限管理</span>
      </el-menu-item>
    </el-submenu>
  </el-menu>
</template>

<style scoped>

</style>